package cn.qiuyu.gift.service.impl;

import cn.qiuyu.gift.domain.Employee;
import cn.qiuyu.gift.mapper.EmployeeMapper;
import cn.qiuyu.gift.query.EmployeeQuery;
import cn.qiuyu.gift.service.IEmployeeService;
import cn.qiuyu.gift.util.PageList;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl  extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Autowired
    public EmployeeMapper employeeMapper;

    @Override
    public PageList<Employee> selectPageList(EmployeeQuery query) {

        final Page<Employee> page = new Page<>(query.getPage(), query.getRows());

        List<Employee> data = employeeMapper.selectPageList(page,query);
         PageList<Employee> list = new PageList<>(page.getTotal(),data);
        return list;
    }
}
